1 File Info

Date: 04-18-2017

Author: Stephanie Langeland

File Name: 10_market_trends_20180418_v1.Rmd

Version: 78

Previous Version/File: 10_market_trends_20180411_v1.Rmd

Dependencies: None

Purpose:

  1. Explore open vs. close data and intraday data on FOMC and non-FOMC dates.

  2. Decide whether to use open vs. close and/or intraday data as response variables in the final LDA model.

Input File(s):

Output File(s): /code/market_trends_images/

Data Output: None

Required by: QMSS Master’s Thesis

Status: Complete

Machine: 2018 MacBook Pro

R version: R version 3.4.3 (2017-11-30), Kite-Eating Tree

2 Open and Close Data

## :::::::::::::::::::: Import Open and Close Data:
options(scipen = 999)

oc_data <- readRDS("/Users/stephanielangeland/Desktop/Columbia/masters_thesis/Langeland_thesis/input_output_files/open_close_data.rds")

str(oc_data)

##View(oc_data)

## :::::::::::::::::::: Add Recession Dates:
oc_data$recession_date <- ifelse(
  oc_data$release_date > "2001-03-01" &
    oc_data$release_date < "2001-11-01" ,
  Inf,
  0
)

oc_data$recession_date <- ifelse(
  oc_data$release_date > "2007-12-01" &
    oc_data$release_date < "2009-06-01" ,
  Inf,
  oc_data$recession_date
)



## :::::::::::::::::::: Create subsets of the dataset - FOMC release dates vs. non-release dates
library(dplyr)

releases_sub <- oc_data %>%
  filter(
    !is.na(stmt_text) |
    !is.na(min_text)
  )

no_releases_sub <- oc_data %>%
  filter(
    is.na(stmt_text) &
    is.na(min_text)
  )

2.1 U.S. corporate credit spread (BICLB10Y) - last price only

## :::::::::::::::::::: Plot:
library(ggplot2)

spread_plot <- ggplot() +
  geom_area(aes(x = oc_data$release_date,
                y = oc_data$recession_date,
                alpha = 0.05),
            fill = "gray83",
            show.legend = F) +
  geom_point(aes(x = no_releases_sub$release_date,
                y = no_releases_sub$BICLB10Y_LAST_PRICE,
                color = "Non-FOMC Dates"
                )) +
  geom_point(aes(x = no_releases_sub$release_date,
                y = no_releases_sub$BICLB10Y_LAST_PRICE,
                color = "Non-FOMC Dates",
                text = paste("Non-FOMC Date: ",
                                as.character(no_releases_sub$release_date),
                                "\n",
                                "U.S. corporate credit spread (last price): ",
                                no_releases_sub$BICLB10Y_LAST_PRICE)),
             size = 0.9) +
  geom_point(aes(x = releases_sub$release_date,
                y = releases_sub$BICLB10Y_LAST_PRICE,
                color = "FOMC Dates",
                text = paste("FOMC Meeting Materials Release Date: ",
                                as.character(releases_sub$release_date),
                                "\n",
                                "U.S. corporate credit spread (last price): ",
                                releases_sub$BICLB10Y_LAST_PRICE))) +
  labs(title = "U.S. Corporate Credit Spread on FOMC vs. Non-FOMC Dates",
       x = "Date",
       y = "U.S. Corporate Credit Spread") +
  scale_colour_manual("Legend", 
                      breaks = c("FOMC Dates", 
                                 "Non-FOMC Dates"),
                      values = c("magenta1", "gray45")) +
  theme(
    panel.border = element_rect(fill = NA),
    panel.background = element_rect(fill = "white"),
    panel.grid.major = element_line(colour = "gray",
                                    size = 0.25),
    panel.grid.minor = element_line(colour = "gray",
                                    size = 0.25)
  ) 

spread_plot

Interactive Plot:

library(plotly)

ggplotly(spread_plot,
         tooltip = c("text"))
## :::::::::::::::::::: Tables:
mean(releases_sub$BICLB10Y_LAST_PRICE, 
     na.rm = T) ## mean on FOMC dates
## [1] 257.6886
mean(no_releases_sub$BICLB10Y_LAST_PRICE, 
     na.rm = T) ## mean on non-FOMC dates
## [1] 248.6605

Notes: Average U.S. corporate credit spread is higher on release days.

2.2 10-year constant maturity rate (H15T10Y)

library(QMSS)

Tab(releases_sub$H15T10Y_change_cat)  ## FOMC dates
##    Count   Pct Cum.Pct
## -1   130 36.93   36.93
## 0    124 35.23   72.16
## 1     98 27.84  100.00
Tab(no_releases_sub$H15T10Y_change_cat) ## non-FOMC dates
##    Count   Pct Cum.Pct
## -1  2060 36.19   36.19
## 0   1981 34.80   70.99
## 1   1651 29.01  100.00

Notes: Doesn’t seem like FOMC releases change the trend at all.

2.3 S&P 500 Index (SPX Index)

Tab(releases_sub$SPX_change_cat)  ## FOMC dates
##    Count   Pct Cum.Pct
## -1   159 45.17   45.17
## 1    193 54.83  100.00
Tab(no_releases_sub$SPX_change_cat) ## non-FOMC dates
##    Count   Pct Cum.Pct
## -1  2630 46.21   46.21
## 0      5  0.09   46.29
## 1   3057 53.71  100.00

Notes: Doesn’t seem like FOMC releases change the trend at all.

2.4 3-month U.S. overnight index swap rate (USSOC Currency)

Tab(releases_sub$USSOC_change_cat)  ## FOMC dates
##    Count   Pct Cum.Pct
## -1   110 41.20   41.20
## 0     15  5.62   46.82
## 1    142 53.18  100.00
Tab(no_releases_sub$USSOC_change_cat) ## non-FOMC dates
##    Count   Pct Cum.Pct
## -1  1601 40.32   40.32
## 0    227  5.72   46.03
## 1   2143 53.97  100.00

Notes: Doesn’t seem like FOMC releases change the trend at all.

2.5 CBOE VIX Index (VIX)

Tab(releases_sub$VIX_change_cat)  ## FOMC dates
##    Count   Pct Cum.Pct
## -1   229 65.06   65.06
## 0      2  0.57   65.62
## 1    121 34.38  100.00
Tab(no_releases_sub$VIX_change_cat) ## non-FOMC dates
##    Count   Pct Cum.Pct
## -1  3227 56.69   56.69
## 0     36  0.63   57.33
## 1   2429 42.67  100.00

Notes: Doesn’t seem like FOMC releases change the trend at all.

2.6 Crude oil price (CLA Comdty)

Tab(releases_sub$CLAComdty_change_cat)  ## FOMC dates
##    Count   Pct Cum.Pct
## -1    20 55.56   55.56
## 1     16 44.44  100.00
Tab(no_releases_sub$CLAComdty_change_cat) ## non-FOMC dates
##    Count   Pct Cum.Pct
## -1   263 47.64   47.64
## 0      3  0.54   48.19
## 1    286 51.81  100.00

Notes:

  • Never 0 (no volatility in the 3-month U.S. overnight index swap rate) on FOMC dates

  • 3-month U.S. overnight index swap rate usually goes down on FOMC dates so the fed might calm markets - could indicate successful transparency because they don’t disrupt the market too much. The opposite is true overall on non-FOMC dates.

2.7 Moody’s BAA corporate bond yield (MOODCBAA Index) - last price only

mean(releases_sub$MOODCBAA_LAST_PRICE, na.rm = T)  ## FOMC dates
## [1] 6.454063
mean(no_releases_sub$MOODCBAA_LAST_PRICE, na.rm = T) ## non-FOMC dates
## [1] 6.554984

Notes: Doesn’t seem like FOMC releases change the trend at all.

2.8 CBOE Interest Rate 10-year Treasury Note (^TNX)

Tab(releases_sub$TNX_change_cat)  ## FOMC dates
##    Count   Pct Cum.Pct
## -1   163 46.31   46.31
## 0     12  3.41   49.72
## 1    177 50.28  100.00
Tab(no_releases_sub$TNX_change_cat) ## non-FOMC dates
##    Count   Pct Cum.Pct
## -1  2753 50.38   50.38
## 0    173  3.17   53.55
## 1   2538 46.45  100.00

Notes: T-bill rate usually goes up on FOMC dates but it usually go down overall on non-FOMC dates. Historically, they’ve lowered rates more than they’ve lowered them during the sample period:

Tab(oc_data$TNX_change_cat)
##    Count   Pct Cum.Pct
## -1  2916 50.14   50.14
## 0    185  3.18   53.32
## 1   2715 46.68  100.00

3 Intraday Data

3.1 S&P 500 Index (SPX Index)

spx <- readRDS("/Users/stephanielangeland/Desktop/Columbia/masters_thesis/Langeland_thesis/input_output_files/spx_intraday.rds")

str(spx)

releases_spx_sub <- spx %>%
  filter(
    !is.na(type) |
    !is.na(type)
  )

releases_spx_sub <- na.omit(releases_spx_sub)

no_releases_spx_sub <- spx %>%
  filter(
    is.na(type) &
    is.na(type)
  )
spx_rel <- colMeans(releases_spx_sub[, 5:62],
                     na.rm = T) ## fomc dates

#spx_rel

spx_norel <- colMeans(no_releases_spx_sub[, 5:62],
                       na.rm = T) ## non-fomc dates

#spx_norel 
plot(spx_rel,
     type = "p",
     col = "red",
     ylab = "")

par(new = TRUE)

plot(spx_norel,
     type = "l",
     col = "black")

Notes: Doesn’t look like there’s a difference in the 2 trends.

3.2 3-month U.S. overnight index swap rate (USSOC Currency)

ussoc <- readRDS("/Users/stephanielangeland/Desktop/Columbia/masters_thesis/Langeland_thesis/input_output_files/ussoc_intraday.rds")

str(ussoc)

#View(ussoc)

releases_ussoc_sub <- ussoc %>%
  filter(
    !is.na(type) |
    !is.na(type)
  )

releases_ussoc_sub <- na.omit(releases_ussoc_sub)

##View(releases_ussoc_sub)

no_releases_ussoc_sub <- ussoc %>%
  filter(
    is.na(type) &
    is.na(type)
  )

#View(no_releases_ussoc_sub)
ussoc_rel <- colMeans(releases_ussoc_sub[, 5:90],
                       na.rm = T) ## fomc dates

#ussoc_rel

ussoc_norel <-colMeans(no_releases_ussoc_sub[, 5:90],
                       na.rm = T) ## non-fomc dates

#ussoc_norel
plot(ussoc_rel,
     type = "p",
     col = "red",
     ylab = "")

par(new = TRUE)

plot(ussoc_norel,
     type = "l",
     col = "black")

Notes: A little bit of a difference in trend.

3.3 CBOE VIX Index (VIX)

vix <- readRDS("/Users/stephanielangeland/Desktop/Columbia/masters_thesis/Langeland_thesis/input_output_files/vix_intraday.rds")

str(vix)

#View(vix)

releases_vix_sub <- vix %>%
  filter(
    !is.na(type) |
    !is.na(type)
  )

releases_vix_sub <- na.omit(releases_vix_sub)

#View(releases_vix_sub)

no_releases_vix_sub <- vix %>%
  filter(
    is.na(type) &
    is.na(type)
  )

#View(no_releases_vix_sub)
vix_rel <- colMeans(releases_vix_sub[, 5:34],
                       na.rm = T) ## fomc dates

#vix_rel

vix_norel <- colMeans(no_releases_vix_sub[, 5:34],
                       na.rm = T) ## non-fomc dates

#vix_norel
plot(vix_rel,
     type = "p",
     col = "red",
     ylab = "")

par(new = TRUE)

plot(vix_norel,
     type = "l",
     col = "black")

Notes: Little bit of a difference in trend - release dates are trending lower.

3.4 Crude oil price (CLA Comdty)

cla <- readRDS("/Users/stephanielangeland/Desktop/Columbia/masters_thesis/Langeland_thesis/input_output_files/cla_intraday.rds")

str(cla)

#View(cla)

releases_cla_sub <- cla %>%
  filter(
    !is.na(type) |
    !is.na(type)
  )

releases_cla_sub <- na.omit(releases_cla_sub)

#View(releases_cla_sub)

no_releases_cla_sub <- cla %>%
  filter(
    is.na(type) &
    is.na(type)
  )

#View(no_releases_cla_sub)
cla_rel <- colMeans(releases_cla_sub[, 5:41],
                       na.rm = T) ## fomc dates

#cla_rel

cla_norel <- colMeans(no_releases_cla_sub[, 5:41],
                       na.rm = T) ## non-fomc dates

#cla_norel
plot(cla_rel,
     type = "p",
     col = "red",
     ylab = "")

par(new = TRUE)

plot(cla_norel,
     type = "l",
     col = "black")

Notes: Little bit of a difference in trend - release dates are trending higher.

3.5 10-year Treasury yield (CT10 Govt)

ct10 <- readRDS("/Users/stephanielangeland/Desktop/Columbia/masters_thesis/Langeland_thesis/input_output_files/ct10govt_intraday.rds")

str(ct10)

#View(ct10)

releases_ct10_sub <- ct10 %>%
  filter(
    !is.na(type) |
    !is.na(type)
  )

releases_ct10_sub <- na.omit(releases_ct10_sub)

#View(releases_ct10_sub)

no_releases_ct10_sub <- ct10 %>%
  filter(
    is.na(type) &
    is.na(type)
  )

#View(no_releases_ct10_sub)
ct10_rel <- colMeans(releases_ct10_sub[, 5:90],
                       na.rm = T) ## fomc dates

#ct10_rel

ct10_norel <- colMeans(no_releases_ct10_sub[, 5:90],
                       na.rm = T) ## non-fomc dates

#ct10_norel
plot(ct10_rel,
     type = "p",
     col = "red",
     ylab = "")

par(new = TRUE)

plot(ct10_norel,
     type = "l",
     col = "black")

Notes: Doesn’t look like there’s a difference in the 2 trends.

4 Conclusion: Only use open vs. close data in the final LDA model.